home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
tvcolor.exe
/
COLORDLG.DOC
< prev
next >
Wrap
Text File
|
1992-06-27
|
16KB
|
376 lines
TVColorDialog Version 1.01
(C) Copyright 1992 Michael Newton and Comsoft Software.
All rights reserved.
The TVColorDialog C++ library was created with Borland C++ verion 3.1 and
Borland's Turbo Vision version 1.0.
Borland's Turbo Vision version 1.0 is required to use the TVColorDialog
library.
Michael Newton
Comsoft Software
17874 Marygold Ave. Suite 32
Bloomington CA 92316 USA
Voice (714) 877-4655
CompuServe 70402,531 (as Michael J. Newton)
RelayNet/RIME ->ECTECH (as Mick Newton)
Internet 70402.531@compuserve.com
********************************* NOTICE *************************************
IMPORTANT! Please read this entire file before attempting to use COLORDLG.LIB.
********************************************************************************
--------------------------------------------------------------------------------
Files included in this archive
------------------------------
Filename Size Date Time Description
-------------------------------------------------
COLORDLG.LIB 19968 06-27-92 1:01a TVColorDialog large model C++ library file
COLORDLG.HPP 7603 06-27-92 1:01a Header file for COLORDLG.LIB
COLORDLG.DOC 13857 06-27-92 1:01a This file
TDEMO.CPP 20712 06-27-92 1:01a C++ source for TVColorDialog demo program
TDEMO.HPP 2809 06-27-92 1:01a Header file for TVColorDialog demo program
ORDER.DOC 1585 06-27-92 1:01a Order form
--------------------------------------------------------------------------------
What is it?
-----------
TVColorDialog is a Turbo Vision dialog box that gives users of your Turbo
Vision application the ability to change the colors and background pattern
inside your application.
TVColorDialog consists of the TVColorDialog class and support files, in C++
large memory model library form.
Fully commented C++ source code for TVColorDialog is also available for a
nominal fee.
Page 1
TVColorDialog Version 1.01
--------------------------------------------------------------------------------
How do I use it?
----------------
TVColorDialog class summary (COLORDLG.HPP)
TDialog ----> TVColorDialog
The TVColorDialog class provides viewers from which the user can select and
change the color assignments and background pattern from available palettes with
immediate effect on the screen. It is a specialized scrollable dialog box called
"Colors and desktop pattern" from which the user can examine various palette
selections and pattern characters before making a selection.
Constructor:
TVColorDialog(TPalette *aPalette, TColorGroup *aGroups,
TSItem *aStrings, Boolean addHelpButton = False);
TVColorDialog(StreamableInit);
Data Members:
TColorDialog::bakLabel TColorDialog::bakSel
TColorDialog::display TColorDialog::forLabel
TColorDialog::forSel TColorDialog::groups
TColorDialog::monoLabel TColorDialog::monoSel
TColorDialog::pal TColorDialog::patSel
TColorDialog::aHelpButton
Member Functions:
TColorDialog::build TColorDialog::dataSize
TColorDialog::getData TColorDialog::handleEvent
TColorDialog::read TColorDialog::setData
TVColorDialog::TVColorDialog TColorDialog::write
TVColorDialog is used almost exactly as you would use Turbo Vision's
TColorDialog class. The only difference is that you must also pass it a pointer
to a TSItem object. The TSItem object is actually a linked list of TSItems, each
of which is actually a pointer to a string. The first character in each string
will be used by TVColorDialog as a pattern character selection in the dialog
box.
The pattern characters are used to create a TPatternCluster of
TPatternButtons which the user can use to select a pattern character for the
background.
The TVColorDialog constructor also accepts an optional Boolean parameter
which, if set, will cause TVColorDialog to include a "help" button in the dialog
box. If you use this option, you should set the helpCtx member of the dialog box
before execView'ing it or insert'ing it.
Please read the source code in TDEMO.CPP to get a better idea of how
TVColorDialog is used.
Page 2
TVColorDialog Version 1.01
--------------------------------------------------------------------------------
*************************** IMPORTANT NOTICE! *********************************
* *
* Please read and follow these instructions before attempting to use *
* TVColorDialog in your applications. *
* *
********************************************************************************
To use TVColorDialog, some minor modifications will be needed in the Turbo
Vision source code. TVColorDialog will not compile without these changes. If you
don't have access to the Turbo Vision source code, or don't want to edit the
source and re-compile, then TVColorDialog isn't for you. The changes necessary
are rather minor though, and I have never experienced any problems with the
changes after rebuilding the library. So if your still interested, read on.
The only file that needs to be changed is APP.H in the Turbo Vision include
directory. Follow these simple instructions...
(1) Change to the Turbo Vision include directory. This is usually named
C:\BORLANDC\TVISION\INCLUDE
(2) Start BC, or your favorite text editor, and load the file APP.H
(3) Move down to line 25. It's a blank line in the TBackground class
declaration. Just below the line that reads...
virtual TPalette& getPalette() const;
(4) Add the following two inline functions...
inline char setPattern(char newPattern)
{
char oldPattern = pattern;
pattern = newPattern;
return oldPattern;
};
inline char getPattern(void)
{
return pattern;
};
These to functions will give your applications "public" access to the
"private" member variable "pattern". The pattern character is the character used
for the background pattern in Turbo Vision applications.
Page 3
TVColorDialog Version 1.01
--------------------------------------------------------------------------------
IMPORTANT NOTICE! (cont.)
-----------------
(5) Now, move down to line 95, into the declaration for TDeskTop. This line
reads "private:", and causes the following member variable "TBackground
*background;" to be a "private" member of TDeskTop. Delete line 95. This
makes "background" a public member of TDeskTop and gives your program access
to TApplication's background.
(6) Save the file as APP.H
(7) Rebuild TV.LIB...
(A) Change to the Turbo Vision source directory. This is usually named
C:\BORLANDC\TVISION\SOURCE
(B) Open the make file named "MAKEFILE."
(C) Move to line 12, it reads "BCROOT = ..\..", and make sure this path is
the correct path to your BORLANDC directory. I had to change mine to
read "BCROOT = E:\BC". Save the file.
(B) Type "make" and press <ENTER>.
That's all the modifications necessary. After TV.LIB has been rebuilt, you
can change the desktop's background pattern character by using the setPattern
function which you added in step 4 above, and get the current pattern character
with the getPattern function...
Example:
// Set desktop pattern character to ascii 197 ┼
deskTop->background->setPattern(197);
// Get the current pattern character into a variable
char currentPattern